package com.nus.frogworks;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {
	
	EditText LogFrequency, BackupFrequency;
	
	private final static String EXTRA_LOG = "com.nus.frogworks.LOG";
	private final static String EXTRA_BACKUP = "com.nus.frogworks.BACKUP";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
	public void runNormalRide(View view){
		Intent intent = new Intent(this,RideActivity.class);
		EditText logFrequency = (EditText) findViewById(R.id.log_frequency);
		EditText backupFrequency = (EditText) findViewById (R.id.backup_frequency);
		int logFreq = Integer.parseInt(logFrequency.getText().toString());
		int backupFreq = Integer.parseInt(backupFrequency.getText().toString());
		intent.putExtra(EXTRA_LOG, logFreq);
		intent.putExtra(EXTRA_BACKUP, backupFreq);
		startActivity(intent);
	}
	
	public void runDriveCycle(View view){
		Intent intent = new Intent(this,DriveCycleActivity.class);
		EditText logFrequency = (EditText) findViewById(R.id.log_frequency);
		EditText backupFrequency = (EditText) findViewById (R.id.backup_frequency);
		int logFreq = Integer.parseInt(logFrequency.getText().toString());
		int backupFreq = Integer.parseInt(backupFrequency.getText().toString());
		intent.putExtra(EXTRA_LOG, logFreq);
		intent.putExtra(EXTRA_BACKUP, backupFreq);
		startActivity(intent);
	}
}
